// Stack Demo 1
// By DreamVB 10:56 26/09/2016

#include <iostream>

using namespace std;
using std::cout;
using std::endl;

#define MAX_STACK 100

int _stack[MAX_STACK];
int tos = 0;

bool Full(){
	return tos >= MAX_STACK - 1;
}

bool Empty(){
	return tos == 0;
}

void Push(int value){
	if (Full()){
		return;
	}
	tos++;
	_stack[tos] = value;
}

int Pop(){
	int t = _stack[tos];
	tos--;
	return t;
}

int main(int argc, char *argv[]){
	int i = 1;

	cout << "Stack Empty = " << Empty() << endl;
	cout << "Push items on stack" << endl;

	//Add 5 times table to the stack.
	while (i <= 12){
		Push(i * 5);
		i++;
	}
	
	cout << "Stack Empty = " << Empty() << endl;

	//Pop and display the results of the stack.
	while (!Empty()){
		cout << Pop() << endl;
	}

	cout << "Stack Empty = " << Empty() << endl;

	system("pause");
	return 0;
}